I have tried to install Python 3.4 on Windows 7 using the following guide
I have added the following to my Path in system environmental variables
C:\Python34\;C:\Python34\Scripts;
When I open up the Python command line and type the following (as instructed in the tutorial) I receive an error message printed below
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
python --version <- what i type
Traceback (most recent call last):
File "", line 1, in
NameError: name 'python' is not defined
Can anyone help me out?
You need to type python --version from the command line. Not when you are already running python.
As has been mentioned, you need to run your command from the command prompt:
python --version
However, if you are in the python interpreter, you can find the current version with this code:
import sys
print (sys.version)
Related
Trying to run simple python file in python prompt but giving an error:
content of test.py
print("Trying to print this using .py file on anaconda prompt")
Running file from python prompt
(base) C:\Users\acharbha>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python C:\Users\acharbha\Documents\python\test.py
File "<stdin>", line 1
python C:\Users\acharbha\Documents\python\test.py
^
SyntaxError: invalid syntax
>>>
To execute in shell: python test.py
To execute inside the interpreter: exec(open("test.py").read())
This should help:
How to execute a file within the python interpreter?
You are trying to run it within the python interpreter. So just exit that and run the command on the terminal.
I use a Gentoo-based Docker image for CI with multiple versions of Python. Recently, I've started experiencing errors because one tool (coveralls) requires sqlite, which is missing. sqlite is part of the Python standard library.
This can be checked from the command line
>>> removing all .pyc files
>>> executing command
me#5b35f99c08af /source $ python
Python 3.6.9 (default, Dec 27 2019, 12:15:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sqlite3'
I couldn't find any notes in the Gentoo packaging database about this, but I'm not really familiar with it as an OS. I assume there must have been a problem building some relevant library.
Python has been installed like this:
RUN emerge -q -u dev-lang/python:3.6
But the error occurs for all the versions I'm currently testing with: >= 3.5. Any ideas as to what I'm doing wrong?
I have been using jpype to integrate with some java code using python lately and have been having no real issues. I am now attempting to set up my stack on a new system and am running into difficulties.
I am running 32-bit Python 3.6.5 and 32-bit oracle Java 1.8 update 171. Python and jpype have been installed using conda (conda create -n venv -c conda-forge python jpype1 arrow), and
jpype.getDefaultJVMPath() returns the expected path (C:\Program Files (x86)\Java\jre1.8.0_171\bin\client\jvm.dll), however an exception is raised stating that it could not find the module. The output from the python console below.
Python 3.6.5 | packaged by conda-forge | (default, Apr 6 2018, 16:13:16) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jpype
>>> import os
>>> jpype.__version__
'0.6.3'
>>> jvm_path=jpype.getDefaultJVMPath()
>>> jvm_path
'C:\\Program Files (x86)\\Java\\jre1.8.0_171\\bin\\client\\jvm.dll'
>>> os.path.exists(jvm_path)
True
>>> jpype.startJVM(jvm_path)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\conda\conda\envs\venv\lib\site-packages\jpype\_core.py", line 70, in startJVM
_jpype.startup(jvm, tuple(args), True)
RuntimeError: Unable to load DLL [C:\Program Files (x86)\Java\jre1.8.0_171\bin\client\jvm.dll], error = The specified module could not be found.
at native\common\include\jp_platform_win32.h:58
>>>
What am I missing and/or doing wrong here?
In digging thru differences between the3 windows systems that I have been working on (2 working and this one that was not working) I found that the Microsoft Visual C++ 2010 Redistributable Package (x86) had been installed on the previous 2 systems but not the one exhibiting this behavior.
Installing the C++ redistributable immediately corrected the issue.
How can I run scons on Windows 10 when Python 3.6.1 and Python 2.7.13 is installed? When typing python into my command window I get the following output:
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Since I personally use Python 3.6.x this is fine for me and I do not want to change this.
When typing py -2 into my command window I get the following output:
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
scons does not work with Python 3.x. It needs to be executed with Python 2.7.x. How can I "tell" scons to use Python 2.7.x?
When I just type scons into the command prompt I get the following output:
PS C:\dev\projectX> scons
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007050 (most recent call first):
Try Changing line 23 in scons.bat from:
python "%scriptname%" %*
to
py -2 "%scriptname%" %*
Note that work on getting SCons to run under both py 2 and py 3.5+ is mostly done and should be released in the next month (or so)
Before running scons in Powershell, amend the PATH environment variable to put your Python 2.7 installation at the front. Something like:
SET PATH=C:\Python27;%path%
I want to have Z3python on my Ubuntu 12.04 64-bit. I downloaded Z3 source, and compiled like below:
$autoconf
$./configure
$sudo make
$sudo make a
$sudo make o
Everything went well, but then I tried:
$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import z3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named z3
It seems Z3python is not installed yet? I followed exactly the instructions in README, but it seems to miss something regarding Python binding?
please ignore, what i got is the old version of Z3.
a recommendation: please provide the source code of the latest Z3 in the homepage. i couldnt find it anywhere, then wrongly got the old version. finally, i had to download the latest version from the SourceControl, which was a bit tricky.