I am trying to install EasyGui on Python 3.3 and I don't see to have it. I had gotten it to work with Python 2.7 but not for 3.3.
I follow the instructions from their website:
Unpack the archive file into a temporary directory
Open a console window and navigate to the temporary directory.
At the command prompt, enter the command:
python setup.py install
But I keep getting this error when I use the command 'import easygui':
Traceback (most recent call last):
File "/pyshell#0/", line 1, in
import easygui
ImportError: No module named 'easygui'
For Python 3 you need to call python3 when installing it, so instead of
python setup.py install
you must do
python3 setup.py install
Just add "easygui.py" to your site-packages directory. It will work with any editor. I am using Coderunner, and I had the same problem. It took me an hour to figure it out :)
easy. type pip3 uninstall easygui then pip3 install --user easygui
Related
This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 3 years ago.
when i type:
import numpy as np
i get this error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
i tried to install like :
pip3 install numpy
but this error comes up on the word 'install':
SyntaxError: invalid syntax
i'm working on python 3.7.4 on windows8 32bits
i know it might be trivia but i'm just starting with python
Did you install pip first? If not, follow this:
Download get-pip.py to a folder on your computer.
Open a command prompt and navigate to the folder containing get-pip.py.
Run the following command:
python get-pip.py
You can verify that Pip was installed correctly by opening a command prompt and entering the following command:
pip -V
You should see output similar to the following:
pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
Go to the folder that your pip is located and run your command:
cd c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip
pip install numpy
you should first quit the command line of python and then type pip install numpy in the cmd
First, check are you outside the command line, if yes then
Try
python -m pip install --upgrade pip
then
python -m pip install numpy
If it did not work, try adding python and pip full path in the commands.
One simple way of doing this is by using PyCharm, which can be downloaded for free.
Simply open your project in it, or create a temporary one, go to settings, project settings, and then to project interpreter. Here you can add your current python interpreter or create a new one, and then just press the add button to add libraries into that interpreter.
Now when you use that interpreter in or out of PyCharm, you will have access to any of those libraries you added.
This is not the best way of doing this, however, it is a sure way of making it work, and PyCharm is a great IDE for Python.
I've had a look around, and cannot find an answer to my problem.
All I try to run is
pip3 install -r requirements.txt
but in just about everything I run, I get "invalid syntax" or
Traceback (most recent call last): File "", line 1, in
NameError: name 'python' is not defined
All I am trying to do is install a set of packages from a text file in a folder on my desktop.
This is stressing me, as nothing seems to work.
Id appreciate any help!
Did you by any chance type python in before running that?, if you did then it's throwing that traceback call because it thinks python is a variable, not a command
Also, did you already try installing the package directly from the source?
Most can be run as pip3.x install package where package is the name of what you want to install (e.g Pygame).
I would open a new command shell, terminate processes on current, and run
python -v to know the exact version you have installed. Then pip2.x or pip3.x (where x is version of 2 or 3) install package directly online.
My setup has:
- oracle-instantclient (downgraded from 12 to 11)
- Virtual Environment with Python + Django + cx_Oracle
When I downgraded the oracle-instantclient, I tried to reinstall cx_oracle using:
pip install --upgrade --force-reinstall cx_Oracle
The problem is that cx_Oracle keeps complaining that I'm not using the previous installed version 12:
$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: libclntsh.so.12.1: cannot open shared object file: No such file or directory
So, some questions here: "--force-reinstall" is not supposed to make a full reinstall, including a module recompile (aka cx_Oracle)? Somebody has some suggestion about how to workaround this issue? I looked at the pip manual and just tells me that it reinstalls the package. Not very useful.
Update1:
I tried to follow the solution here, adding my cx_Oracle path to the LD_LIBRARY_PATH but it's still not working.
echo $LD_LIBRARY_PATH
/usr/lib/oracle/11.2/client64/lib:/home/myuser/myuserenv/lib/python3.5/site-packages/cx_Oracle-5.2.1.dist-info
Note that my root user has a different python while my virtualenv uses its own python installation.
[root#myserver]# which python
/usr/bin/python
From my virtual environment:
(myvirtualenv) [myuser#myserver]$ which python
~/myvirtualenv/bin/python
Is there some way of installing cx_Oracle manually using my root user but putting the files at the virtual environment somehow?
Update2:
I tried to download cx_Oracle and compile manually using the following command:
sudo -u myuser ~/myvirtualenv/bin/python setup.py build install
But now I'm seeing some permission errors:
(...)
error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
Am I doing the right thing? I don't want to mess this environment. Thanks.
The answer to your question (although you seem to have had another problem) is as follows:
It depends on the module's structure. If its setup script calls the compiler, then yes it does. Because, you see, pip modules by default do not include compiled parts, it's up to the module author to provide them.
I could finally install. The problem is that I had to use the python of my virtualenv. A simple solution but that I completely missed.
Steps:
pip download cx_Oracle
tar -xvf cx_Oracle-5.2.1.tar.gz
~/myenv/bin/python setup.py -v build
sudo ~/myenv/bin/python setup.py install
Note that I had to use sudo in the last step. Without this I was having this permission error:
error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
I have installed pip and ez setup. I also checked the system path and I can see the module in the folder structure. Still when i try to run pip command, I get an Import error saying no module named pip. I am running 32bit python on a windows7 machine
Just be sure that you have include python to windows PATH variable, then run python -m ensurepip
After running get_pip.py with python embed you have to modify your pythonXX._pth file. Add Lib\site-packages, to get something like this:
pythonXX.zip
.
Lib\site-packages
# Uncomment to run site.main() automatically
#import site
If you don't you will get this error:
ModuleNotFoundError: No module named 'pip'
or
python-3.8.2-embed-amd64\python.exe: No module named pip
λ pip
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 86, in _run_code
File "python-3.8.2-embed-amd64\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
λ python -m pip
python-3.8.2-embed-amd64\python.exe: No module named pip
This issue occurs with me while I was trying to upgrade pip version.
It was resolved with the following commands:
python -m ensurepip
The above command restores the pip and below mentioned upgrades it.
python -m pip install --upgrade pip
What solved the issue on my case was go to:
cd C:\Program Files\Python37\Scripts
And run below command:
easy_install.exe pip
Follow steps given in https://michlstechblog.info/blog/python-install-python-with-pip-on-windows-by-the-embeddable-zip-file/. Replace x with version number of Python.
Open the pythonxx.__pth file, located in your python folder.
Edit the contents (e.g. D:\Pythonx.x.x to the following):
D:\Pythonx.x.x
D:\Pythonx.x.x\DLLs
D:\Pythonx.x.x\lib
D:\Pythonx.x.x\lib\plat-win
D:\Pythonx.x.x\lib\site-packages
try to type pip3 instead pip.
also for upgrading pip dont use pip3 in the command
python -m pip install -U pip
maybe it helps
turned out i had 2 versions of python on my laptop
both commands worked for me
python -m ensurepip
py -m ensurepip
both with another installation path
c:\tools\python\lib\site-packages
c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages
only the first path was in my %PATH% variable
First make sure that python is added in environment variable.
Try checking the version of pip or pip3. Use these commands to check.
For pip:
pip --version
For pip3:
pip3 --version
If you can see any version of pip and still not able to use it, then run the following command.
python -m ensurepip
This ensures the pip in your system.
Running these 2 commands helped me:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
If you wrote
pip install --upgrade pip
and you got
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.1
Uninstalling pip-20.2.1:
ERROR: Could not install packages due to an EnvironmentError...
then you have uninstalled pip instead install pip.
This could be the reason of your problem.
The Gorodeckij Dimitrij's answer works for me.
python -m ensurepip
I found this post while looking for a solution for the same problem. I was using an embedded python distribution. In this case, the solution is to uncomment import site in the file python<version>._pth.
The ensurepip module was added in version 3.4 and then backported to 2.7.9.
So make sure your Python version is at least 2.7.9 if using Python 2, and at least 3.4 if using Python 3.
I'v solved this error by setting the correct path variables
C:\Users\name\AppData\Local\Programs\Python\Python37\Scripts
C:\Users\name\AppData\Local\Programs\Python\Python37\Lib\site-packages
I was facing same issue and resolved using following steps
1) Go to your paython package and rename "python37._pth" to python37._pth.save
2) curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
3) then run python get-pip.py
4) pip install django
Hope this help
I've solved this error downloading the executable file for python 3.7.
I've had downloaded the embeddeable version and got that error.
Now it works! :D
The method I'm going to tell might not be the correct way to do it. But this method solved my issue. I tried every solution on youtube and StackOverflow methods.
If you have two python versions installed. Delete one. I have the python 3.8.1 and 3.9.0 versions installed. I deleted version 3.9.0 from the C directory.
Now go to the control panel > System and security > System > Advanced system settings.
Click on 'environment variables'.
Select the path and click on 'edit'
Now, add the path of the python and also the path of pip module. In my case it was c:\python38 and c:\python38\scripts
This method solved my issue.
Instead of Python zip install python by python installer. It fixed the issue for me.
I am trying to setup this python library and am having a very hard time. I suspect it is because I am a hobby programmer, but I have successfully installed programs in the past using the command line. I am using Windows and Python 2.6.
The help that is shown below is taken from the website.
wget http://pypi.python.org/packages/source/y/yql/yql-0.2.tar.gz
tar -xzf yql-0.2.tar.gz
cd yql-0.2
python setup.py install
In doing a number of Google searches, it seems that this is for Unix/Mac commands. My previous process has not worked, so I am looking for all of the help I can get.
Many thanks in advance!
Brock
Here is the error:
>>> import yql
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "c:\python25\lib\site-packages\yql-0.6-py2.5.egg\yql\__init__.py", line 201, in <module>
class Public(object):
File "c:\python25\lib\site-packages\yql-0.6-py2.5.egg\yql\__init__.py", line 229, in Public
#scheme.setter
AttributeError: 'property' object has no attribute 'setter'
Those are definately Unix/Linux commands to install python module. The installation in windows is pretty much similar. Follow the instructions given below
Download the library from the website.
Extract it using Winzip or WinRAR.
It will create a directory with name like foo-0.2. The directory should contain a script named setup.py
Now open the command prompt and cd to that directory
At command prompt type following
python setup.py install
Also check the following link for more detailed instructions
http://docs.python.org/release/2.6/install/index.html
What's the error message? Also what OS are you using? The install instructions seem fine.
In Debian & in most Unix Systems you could also these -
sudo pip install <module_name> to install any module.
or sudo easy_install <module_name>
or sudo apt-get install <module_name>
or you could do what you mentioned in the question. Should work fine.
Maybe you don't have root access. Package installation needs that. Post more info for more constructive comments. All the best.
If you install setuptools first (see setuptools on pypi) and add C:\Python26\Scripts to your PATH variable you can run the following:
easy_install yql-0.2.tar.gz
after wgetting the archive.
Or even easier, without wgetting the archive, simply run:
easy_install yql
And it'll download and install the latest version of yql with all the dependencies.
The above answer for installing wget is to download wget for Python.
Download the tar file and unpack the file
Then cd to the folder and run in terminal
python setup.py install
This is to install wget into Python
Try this
import tensorflow
word2vec_path = 'YOUR LINK HERE'
word2vec = models.KeyedVectors.load_word2vec_format(word2vec_path, binary=True)